/* main.c
 * Compiler: C32
 * The db_utils run only on the starter kit (not in SIM)
 * Note also that DBINIT() does not do anything.
 * You must define the preprocessor symbol PIC32_STARTER_KIT to use the debug
 * print utility.
 */

// Configuration Bit settings
// SYSCLK = 80 MHz (8MHz Crystal/ FPLLIDIV * FPLLMUL / FPLLODIV)
// PBCLK = 40 MHz
// Primary Osc w/PLL (XT+,HS+,EC+PLL)
// WDT OFF
// Other options are don't care
//
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_8

#define SYS_FREQ 			(80000000L)
//-------------------------------------------------------------------------------

#include <xc.h>
#include <plib.h>


#define LED_PORT    IOPORT_D
#define LED1        BIT_0
#define LED2        BIT_1
#define LED3        BIT_2

int main()
{
    unsigned int i;
    PORTSetPinsDigitalOut(LED_PORT, LED3|LED2|LED1);  // PORT,PINS
        
    DBINIT(); //Initialize the IO channel
    DBPRINTF("Basic Starter Kit Lab (" __DATE__ ", " __TIME__ ")\n");
    DBPUTS("Hello from PIC32 \n");

    while (1)
    {
        PORTToggleBits(LED_PORT, LED3|LED2|LED1);
        //PORTSetBits(LED_PORT, LED1|LED2|LED3);
        //PORTClearBits(LED_PORT, LED1|LED2|LED3);
        i = 1024*256;
        while (i--);
    }
    
    return 0;
}